package weaver.aiyh_quanshi;

import weaver.aiyh_quanshi.entity.QsAccount;
import weaver.aiyh_quanshi.entity.QsConfParty;
import weaver.aiyh_quanshi.entity.QsResponse;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * @author EBU7-dev1-ayh
 * @create 2021/9/16 0016 16:04
 * qinqiujiekou
 */


public class RequestApi {
	public RequestApi(){
		String keyPath = Objects.requireNonNull(this.getClass().getResource("")).getPath();
		QsAPI.init("6", "configtest.quanshi.com"
				, keyPath + "key_store" + File.separator + "mg.client.p12"
				, keyPath + "key_store" + File.separator + "server.truststore");
	}

	/**
	 * 创建预约会议
	 * @param email 创建人邮箱
	 * @param title 会议标题
	 * @param length 会议时长，分钟为单位
	 * @param startTime 会议开始时间
	 * @param list 参会人员列表
	 * @return
	 */
	public QsResponse createMeting(String email, String title, int length, String startTime, List<QsConfParty> list){
		return QsAPI.reservConference(email,title,length,startTime, null, list);
	}

	public QsResponse cancelConference(String conferenceId, String email){
		return QsAPI.cancelConference(conferenceId,email, false,false);
	}

	public QsResponse getQuanShiInfo(String conferenceId){
		return QsAPI.getConferenceInfo(conferenceId);
	}

	public QsResponse getInfoByEmail(List<String> list){
		return QsAPI.getUserIdsByEmails(list);
	}
}
